*------------------------------------------------------------------------------*
						*** SOEP REGRESSION ***
*------------------------------------------------------------------------------*


** user =		/* Insert here the SOEP remote username */
** password = 		/* Insert here the SOEP remote password */
** package = STATA
** project = GSOEP

*------------------------------------------------------------------------------*

***Macros
*Dependent variables
local outcome "Incumbent Est_opp angry_dummy worried_dummy happy_dummy sad_dummy pc1 risk_averse risk_loving"  // Potentially add: worries_econ_development worries_own_economic

*------------------------------------------------------------------------------*

use "${mydata_user}airpollution_analysis", clear

*------------------------------------------------------------------------------*

foreach var of local outcome {

	xtreg `var' i.ma07_pm10_binary age c.age#c.age married children yrs_educ n_hh_income c.ma07_temp##c.ma07_temp c.ma07_wind_speed##c.ma07_wind_speed c.ma07_precip_amount##c.ma07_precip_amount i.year i.quarter i.fed_state, fe 		// {OUTCOME VARIABLE} has to be replaced by the respective outcome variable of interest
	summ `var' if e(sample)==1

} // var


/*
The outputs of the regressions above need to be stored to populate the dataset SOEP_remote_20210629.csv
used to produce Figure 2. The SOEP does not allows this procedure to be done with a code, so we manually
saved the results in the spreadsheet. Below is the list of relevant outputs needed to populate the spreadsheet.

General information
- outcome = name of variable contained in local outcome
- treatment = main independent variable of interest: ma07_pm10_binary

Regression outputs
- regression = regression model used: OLS or OLS/FE
- beta = coefficient of i.ma07_pm10_binary
- cil = lower bound of 95% confidence interval of i.ma07_pm10_binary
- cih = upper bound of 95% confidence interval of i.ma07_pm10_binary
- N = Number of obs
- F-stat = F test that all u_i=0

Summary outputs
- mean_outcome = Mean
- sd_outcome = Std. Dev.
*/

*------------------------------------------------------------------------------*

clear 

exit
